package com.twu.biblioteca.services;

import com.twu.biblioteca.BibliotecaApp;
import com.twu.biblioteca.resources.ReservationCatalog;
import com.twu.biblioteca.Session;
import com.twu.biblioteca.resources.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: arvind
 * Date: 11/10/13
 * Time: 4:37 PM
 * To change this template use File | Settings | File Templates.
 */
public class BookService {


    public String getBooksDetail() {
        return BookList.getInstance().getBooksDetail();
    }
    public void initiateBookService()
    {
            Scanner getBookId=new Scanner(System.in);

            System.out.println("Enter BookID to reserve : ");
            String bookID=getBookId.next();
            if(BookList.getInstance().isBookIDValid(bookID))
            {
                System.out.println(reserveBook(bookID));
            }
            else
            {
                System.out.println("Please Enter a valid BookID.");
            }

    }
    public String reserveBook(String bookID)
    {
            BookList bookListInstance=BookList.getInstance();
            ReservationCatalog reservationCatalogInstance=ReservationCatalog.getInstance();
            String reservationResponse=reservationCatalogInstance.reserveBook(bookID);
            return reservationResponse;

    }
}
